package com.acxiom.foodreview.controller.api;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.acxiom.foodreview.entity.Result;
import com.acxiom.foodreview.entity.SysUser;
import com.acxiom.foodreview.service.SysUserService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;

/**
 * Created by hadong on 2017-03-23. ExamplesController
 */
@Api(value="系统用户接口")
@RestController
public class SysUserController extends ApiController {

	@Autowired
	private SysUserService sysUserService;

	private Logger log = Logger.getLogger(SysUserController.class);

	/**
	 * register
	 * 
	 * @param sysUser
	 * @return
	 */
	@RequestMapping("sysuser/register")
	@ApiOperation(notes = "用户注册", value = "用户注册", httpMethod = "POST")
	@ApiImplicitParam(name = "sysUser", value = "SysUser实体", required = true, dataType = "SysUser")
	public Result insert(@RequestBody SysUser sysUser) {
		if (sysUserService.createSysUser(sysUser)) {
			return new Result();
		}
		return new Result(500, "register failed");
	}
}
